package com.hxzy.research.controller.adminresearch;

import com.hxzy.research.pojo.ShowCheck1;
import com.hxzy.research.pojo.ShowCheckQq;
import com.hxzy.research.service.pageandmanager.PageBranch;
import com.hxzy.research.service.research.CheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * 创就业
 */
@Controller
public class CareerCheckController {
    @Autowired
    private PageBranch pageBranch;
    @Autowired private CheckService checkService;
    @RequestMapping("/admin/forwardR2List.go")
    public String forwardR2List(Model model)throws Exception{
        //查询分公司列表
        model.addAttribute("branchList",pageBranch.findAllBranch());
        //先跳到点击查询分公司页面
        return "admin/research/r2checkList";
    }
    //根据分公司id和月份查询分公司数据
    @RequestMapping("/admin/getR2List.go")
    public String getR2List(Model model, ShowCheckQq showCheckQq, HttpSession session)throws Exception{
        session.setAttribute("time",showCheckQq.getMonth());
        //查询分公司列表
        model.addAttribute("branchList",pageBranch.findAllBranch());
        List<ShowCheck1> r2list=checkService.findR2ListByMonthAndBranchId(showCheckQq);
        model.addAttribute("r2list",r2list);
        return "admin/research/r2checkList";
    }
    //查看建议
    @RequestMapping("/admin/getR2Suggest.go")
    public String getR2Suggest(Model model,ShowCheckQq showCheckQq,HttpSession session)throws Exception{
        showCheckQq.setMonth((String) session.getAttribute("time"));
        model.addAttribute("suggestList",checkService.findJy2List(showCheckQq));
        return "admin/research/r2SuggestView";

    }
    //根据月份查询分公司总体数据
    @RequestMapping("admin/getAllR2List.go")
    public String getAllR2List(Model model,String month,Integer branchId, HttpSession session)throws Exception{
        //查询分公司列表
        session.setAttribute("time",month);
        session.setAttribute("branchid",branchId);
        model.addAttribute("branchList",pageBranch.findAllBranch());
        //查询总体数据
        List<ShowCheck1> r2list=checkService.findAllR2ListByMonth(month);
        model.addAttribute("r2list",r2list);
        return "admin/research/r2AllcheckList";

    }
    //查询分公司总体数据de建议
    @RequestMapping("/admin/getAllR2Suggest.go")
    public String getAllR2Suggest(Model model,ShowCheckQq showCheckQq,HttpSession session)throws Exception{
        model.addAttribute("suggestList",checkService.findJy2AllList(showCheckQq));
        return "admin/research/r2SuggestView";
    }
}
